﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class FormDemo : Form
    {
        Snake snake;

        public FormDemo()
        {
            InitializeComponent();

            snake = new Snake();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("Before");
            MessageBox.Show("BOULET");
            Debug.WriteLine("After");
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            snake.actuPos();

            this.pictureBox1.Left = snake.X;
            this.pictureBox1.Top = snake.Y;

            snake.checkWall(panel1.Top, panel1.Bottom, panel1.Left, panel1.Right);

        }

        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            MessageBox.Show("bla");

            
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
        }

        private void m(object sender, EventArgs e)
        {

        }

        private void button1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 'z')
                snake.goUp();
            else if (e.KeyChar == 's')
                snake.goDown();
            else if (e.KeyChar == 'q')
                snake.goLeft();
            else if (e.KeyChar == 'd')
                snake.goRight();
        }
    }
}
